package com.university.mentalhealthplatform.appModels;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;
import java.util.UUID;

public class CustomUserDetails implements UserDetails {
    private final Student student;

    public CustomUserDetails(Student student) {
        this.student = student;
    }

    public UUID getStudentId() {
        return student.getId(); // 获取学生的 ID
    }

    // 覆盖 UserDetails 接口的方法

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return List.of();
    }

    @Override
    public String getPassword() {
        return "";
    }

    @Override
    public String getUsername() {
        return student.getName(); // 假设使用学生姓名作为用户名
    }

    // 其他方法 ...
}
